
// 判断是否处于全屏显示
export function isFullScreen() {
  if (document.fullscreen) {
     return true;
   } else if (document.mozFullScreen) {
       return true;
   } else if (document.webkitIsFullScreen) {
       return true;
   } else if (document.msFullscreenElement) {
       return true;
   } else if (window.fullScreen) {
       return true;
   } 
   return false;
}
// 浏览器全屏显示
// 启动全屏!
// launchFullScreen(document.documentElement); // 整个网页
// launchFullScreen(document.getElementById("videoElement")); // 某个页面元素
export function launchFullscreen(element) {
  if(isFullScreen()){// 如果用户在全屏模式下测退出全屏
    exitFullscreen()
    return false
  }
  if (element.requestFullscreen) {
    element.requestFullscreen();
    return true
  } else if (element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
    return true
  } else if (element.webkitRequestFullscreen) {
    element.webkitRequestFullscreen();
    return true
  } else if (element.msRequestFullscreen) {
    element.msRequestFullscreen();
    return true
  }
}
// 退出全屏
export function exitFullscreen() {
  if (document.exitFullscreen) {
    document.exitFullscreen();
  } else if (document.mozCancelFullScreen) {
    document.mozCancelFullScreen();
  } else if (document.webkitExitFullscreen) {
    document.webkitExitFullscreen();
  }
}